package com.mini.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by shixi  on 2020/9/11
 */
@Entity(name = "business_item_info")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@DynamicUpdate
@DynamicInsert
public class BusinessItemInfo implements Serializable {

    private static final long serialVersionUID = -5142975848079627189L;
    /**
     * id
     */
    @ApiModelProperty(value = "项目id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "项目名称")
    private String itemName;

    @ApiModelProperty(value = "使用状态 1:使用中 0：禁用")
    private Integer itemState;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(insertable = false, updatable = false)
    Date updateTime;

    @ApiModelProperty(value = "创建时间/分配时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(insertable = false, updatable = false)
    Date createTime;

    public enum  StateEnum{
        valid(1, "使用中"),
        invalid(0, "禁用"),
        ;
        public Integer code;
        public String desc;

        StateEnum(Integer code, String desc){
            this.code = code;
            this.desc = desc;
        }
    }

}
